# !/usr/bin/env python
# encoding: utf-8


"""
  @author: gaogao
  @file: parse_bin_block_util.py
  @time: 2022/3/14 14:37
  @desc:
"""
import numpy as np

def parse_bin_block_util(bin_block_data):

    if bin_block_data:
        result = bin_block_data.decode("latin-1").strip()
        result = result[1:]  # remove #
        headerLength = int(result[0], 16)
        result = result[1:]  # remove #
        numBytes = int(result[0:headerLength])
        result = result[headerLength:]  # remove
        rawData7744 = result.encode("latin-1")
        for i in [np.float32]:
            data7744 = np.frombuffer(rawData7744, dtype=i)
        result_list = list(data7744)
        return result_list
        # result_list = [log(abs(float(i * 1000)), 10) * 10 for i in result_list]
